package com.ypc.webdemo.controller.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

/**
 * @author peng
 * @Date 2021/12/9
 */
@ApiModel
@Data
public class InDto {
    @ApiModelProperty(value = "当前页编号,取值范围为1~2^31-1")
    @Range(min = 1, max = Integer.MAX_VALUE, message = "当前页编号不能小于1，不能大于2^31-1")
    private Integer pageIndex;
    @ApiModelProperty(value = "每页显示条数,取值范围为1~1000")
    @Range(min = 1, max = 1000, message = "每页显示条数不能小于1，不能大于1000")
    private Integer pageSize;

    public Integer getPageIndex() {

        return pageIndex == null || pageIndex < 1 ? 1 : pageIndex;
    }

    public Integer getPageSize() {
        return pageSize == null || pageSize < 1 ? 10 : pageSize;
    }
}
